package oj;

import java.util.Scanner;

/**
 * @author 郝文雪
 * @date 2022/7/15 10:44
 * @Description Test
 */
public class Day17杨辉三角的变形 {
    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        while(sc.hasNext()){
            int n=sc.nextInt();
            if(n==1 || n==2){
                System.out.println(-1);
            }
            if(n%2==0){
                if(n%4==0){
                    System.out.println(3);
                }else{
                    System.out.println(4);
                }
            }
            if(n%2==1){
                System.out.println(2);
            }

        }
    }
}
